package com.topvision.controller.zwan;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

import com.topvision.controller.AbstractController;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.topvision.model.zwan.Sysdevicevendor;
import com.topvision.service.zwan.SysdevicevendorService;
import com.topvision.util.PageUtils;
import com.topvision.util.Query;
import com.topvision.util.R;

/**
 * 
 *
 * @author shengwm
 * @email 179653076@qq.com
 * @date 2017-08-22 14:23:11
 */
@RestController
@RequestMapping("zwan/sysdevicevendor")
public class SysdevicevendorController extends AbstractController {
    @Autowired
    private SysdevicevendorService sysdevicevendorService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("zwan/sysdevicevendor:list")
    public R list(@RequestParam Map<String, Object> params){
        //查询列表数据
        Query query = new Query(params);

        List<Sysdevicevendor> sysdevicevendorList = sysdevicevendorService.queryList(query);
        int total = sysdevicevendorService.queryTotal(query);

        PageUtils pageUtil = new PageUtils(sysdevicevendorList, total, query.getLimit(), query.getPage());

        return R.success().put("page", pageUtil);
    }


    @RequestMapping("/allList")
    @RequiresPermissions("zwan/sysdevicevendor:list")
    public R allList(@RequestParam Map<String, Object> params){
      List<Map<String,Object>> maps = sysdevicevendorService.allList();
      return R.success(maps);
    }
    /**
     * 信息
     */
    @RequestMapping("/info/{devicevendorid}")
    @RequiresPermissions("zwan/sysdevicevendor:info")
    public R info(@PathVariable("devicevendorid") BigDecimal devicevendorid){
        Sysdevicevendor sysdevicevendor = sysdevicevendorService.queryObject(devicevendorid);
        return R.success().put("sysdevicevendor", sysdevicevendor);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("zwan/sysdevicevendor:save")
    public R save(@RequestBody Sysdevicevendor sysdevicevendor){
		sysdevicevendorService.save(sysdevicevendor);
        return R.success();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("zwan/sysdevicevendor:update")
    public R update(@RequestBody Sysdevicevendor sysdevicevendor){
		sysdevicevendorService.update(sysdevicevendor);
        return R.success();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("zwan/sysdevicevendor:delete")
    public R delete(@RequestBody BigDecimal[] devicevendorids){
		sysdevicevendorService.deleteBatch(devicevendorids);
        return R.success();
    }

}
